# 程序版本
VERSION = v1_0_0
# 编译器选择
CC = gcc
# 宏定义
DEBUG = -DUSE_DEBUG
# 编译选项
CFLAGS = -Wall
AR = ar
ARFLAGS = rv
# 源文件
SOURCES = $(wildcard *.c)
# 头文件
INCLUDES = 
# 库文件名称
LIB_NAMES = 
# 库文件路径
LIB_PATH = 
# 目标文件
OBJ = $(patsubst %.c, output/%.o, $(SOURCES))
# 执行文件
TARGET = app

#links 链接
$(TARGET): $(OBJ)
	$(CC) $(OBJ) $(DEBUG)  $(LIB_PATH) $(LIB_NAMES) -o output/$(TARGET)$(VERSION)
	
#compile 编译
%.o: %.c
	$(CC) $(INCLUDES) $(DEBUG) -c $(CFLAGS) $< -o output/$@

# 运行
.PHONY: run
run:
	@.\output/$(TARGET)$(VERSION)

# 清除编译信息
.PHONY: clean
clean:
	@echo "Remove linked and compiled files....."
	rm -rf $(OBJ) $(TARGET) output